<%--
    Document   : formCourse
    Created on : 31.12.2012, 10:31:08
    Author     : Martin Zmítko <martin.zmitko@gmail.com>
--%>

<%@ include file="/WEB-INF/jsp/header.jsp" %>
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>

        <c:if test="${course.id != 0}">
            <form:form method="post" action="${pageContext.request.contextPath}/smazKurz" class="pull-right">
                <input type="hidden" name="id" value="${course.id}"/>
                <input type="submit" value="<spring:message code="form.remove" />" class="myBtn myBtn-warning" />
            </form:form>
        </c:if>

        <c:if test="${course.id != 0}"> <h2>Editace kurzu - ${course.name}</h2> </c:if>
        <c:if test="${course.id == 0}"> <h2>Přidání kurzu</h2> </c:if>

        <form:form class="form-horizontal" commandName="course" action="course.do">
            <c:if test="${course.id != 0}">
                <div class="control-group">
                    <label class="control-label" for="inputName"><spring:message code="form.id" />:</label>
                    <div class="controls">
                        <form:hidden path="id" readonly="true" /> <span>${course.id}</span>
                    </div>
                </div>
            </c:if>
            <div class="control-group">
                <label class="control-label" for="inputName">Název:</label>
                <div class="controls">
                    <form:input path="name" id="inputName" />
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="inputTeacher">Vyučující:</label>
                <div class="controls">
                    <form:hidden path="teacher.id" /> <span>${course.teacher.firstName} ${course.teacher.lastName}</span>
                </div>
            </div>
            <div class="control-group">
                <div class="controls">
                    <input type="submit" value="<spring:message code="form.save" />" class="myBtn" />
                </div>
            </div>
        </form:form>

        <c:if test="${course.id != 0}">
        <h3>Žáci v tomto kurzu </h3>

         <table class="table table-condensed">
                <tr>
                    <th>Jméno</th>
                    <th>Příjmení</th>
                    <th>Rok narození</th>
                    <th>Detail žáka </th>
                </tr>
                <c:forEach var="js" items="${joinedStudent}">
                <tr>
                    <td>${js.firstName}</td>
                    <td>${js.lastName}</td>
                    <td>${js.yearOfBirth}</td>
                    <td>
                        <a href="studentstatistics.do?id_student=${js.id}&id_course=${course.id}">Statistiky žáka</a>
                    </td>
                </tr>
                </c:forEach>
            </table>

        <a href="courses_students.do?id=${course.id}" class="myBtn"><i class="icon-plus-sign icon-white"></i> Přidání / odebrání žáků pro tento kurz</a>

        <h3>Testy v tomto kurzu </h3>

         <table class="table table-condensed">
                <tr>
                    <th><spring:message code="form.test.name" /></th>
                    <th><spring:message code="form.test.description" /></th>
                    <th><spring:message code="form.test.number" /></th>
                    <th><spring:message code="form.test.type" /></th>
                    <th><spring:message code="form.test.detail" /></th>
                </tr>
                <c:forEach var="jt" items="${joinedTest}">
                <tr>
                    <td>${jt.name}</td>
                    <td>${jt.descr}</td>
                    <td>${jt.number}</td>
                    <td>${jt.types.name}</td>
                    <td>
                        <a href="teststatistics.do?id_test=${jt.id}&id_course=${course.id}">Statistiky testu</a>
                    </td>
                </tr>
                </c:forEach>
            </table>



        <a href="courses_tests.do?id=${course.id}" class="myBtn"><i class="icon-plus-sign icon-white"></i> Přidání / odebrání testů pro tento kurz</a>
        </c:if>
<%@ include file="/WEB-INF/jsp/footer.jsp" %>